package redis

import "time"

// 缓存短信验证码 5分钟有效
func RedisSetSmsCode(mobile, code, sale string) {
	key := "sms:" + mobile + sale
	RedisDB.Set(key, code, time.Minute*5)
}

// 获取短信验证码
func RedisGetSmsCode(mobile, sale string) string {
	key := "sms:" + mobile + sale
	return RedisDB.Get(key).Val()
}

// 销毁短信验证码
func RedisDelSmsCode(mobile, sale string) {
	key := "sms:" + mobile + sale
	RedisDB.Del(key)
}
